import { dzHost } from '../plugins/common'

export const state = () => ({
    user: {
        avatar: ''
    },
    token: null,
})

export const mutations = {
    loggedIn(state, { user, token }) {
        user.avatar = `${dzHost}/uc_server/avatar.php?uid=${user.id}&size=small`
        state.user = user
        state.token = token
    },
    logout(state) {
        state.user = {
            avatar: ''
        }
        state.token = null
    }
}
